package com.sgb.kjwl.view.ui.adapter.shopping;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemGoodsDetailDetailsRecommendBinding;
import com.sgb.kjwl.model.entity.user.RecommendListEntity;
import com.sgb.kjwl.utils.PointUtils;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

/**
 * @author qiangHeNoooo
 * 说明：商品详情页面的底部商品推荐
 * 时间：2021.07.28
 */
public class GoodsDetailsRecommendAdapter extends BaseRecycleAdapter<RecommendListEntity> {

    private ItemGoodsDetailDetailsRecommendBinding mBinding;
    private ResembleGoodsClick mResembleGoodsClick;

    public void setResembleGoodsClick(ResembleGoodsClick mResembleGoodsClick) {
        this.mResembleGoodsClick = mResembleGoodsClick;
    }

    public GoodsDetailsRecommendAdapter(Context context, List<RecommendListEntity> data) {
        super(context, R.layout.item_goods_detail_details_recommend, data);
    }

    @Override
    public void convert(ItemViewHolder holder, final RecommendListEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        mBinding = (ItemGoodsDetailDetailsRecommendBinding) holder.getmBinding();
        mBinding.itemContainer.setOnClickListener((view) -> {
            if (mResembleGoodsClick != null) {
                mResembleGoodsClick.resembleGoodsClick(entity);
            }
        });
        if ("1".equals(entity.getSelfSupportTag())) {
        } else {
        }
        TextView tvPrice = holder.getItem().findViewById(R.id.tv_price1);
        if (entity.getPromoteStatus() == 2) {
            tvPrice.setText(entity.getPromotePrice());
        } else {
        }
    }

    public interface ResembleGoodsClick {
        /**
         * item
         *
         * @param recommendListEntity
         */
        void resembleGoodsClick(RecommendListEntity recommendListEntity);
    }
}
